/**
 * Copyright (C), 2001-2022, www.bosssof.com.cn
 * FileName: LoginApi
 * Author: Administrator
 * Date: 2022-10-8 18:07:44
 * Description:
 * <p> 重构了LoginController接口 新增加了接口给LoginController实现重构了RequestMapping URL
 * History:
 * <author> Administrator
 * <time> 2022-10-8 18:07:44
 * <version> 1.0.0
 * <desc> 版本描述
 */
package com.bosssoft.g1.api;


import com.bosssoft.g1.common.data.vo.CommonResponse;
import com.bosssoft.g1.dto.PageDTO;
import com.bosssoft.g1.entity.User;
import com.bosssoft.g1.query.UserAuthQuery;
import com.bosssoft.g1.query.UserLoginQuery;
import com.bosssoft.g1.vo.ResourceMenuVO;
import com.bosssoft.g1.vo.ResourceVO;
import com.bosssoft.g1.vo.RoleVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;

/**
 * @ClassName: LoginApi
 * @Description: 有用配合前端演示用户增删改查的demo
 * @Author: Administrator
 * @Date: 2023-03-30 16:00
 **/
@CrossOrigin
@Api(tags = "资源管理 ", value = "/v1")
@RequestMapping("/v1")
@Validated
public interface LoginApi {
    /**
     * 提供登录的认证功能
     *
     * @param userAuthQuery 用户信息
     * @return true成功 false失败
     */
    @ApiOperation(value = "登录", notes = "登录")
    @ApiResponses({@ApiResponse(code = 0, message = "请求成功"), @ApiResponse(code = -1, message = "请求执行没有成功但是发生异常")})
    @PostMapping("/login")
    CommonResponse<String> login(@NotNull @Valid @RequestBody @ApiParam(value = "用户数据", required = true) UserLoginQuery userAuthQuery);

    /**
     * 提供获取角色资源的功能
     *
     * @param id 记录id
     * @return true 成功 false失败
     */
    @ApiOperation(value = "删除用户通过id", notes = "通过id删除用户")
    @ApiImplicitParam(name = "id", required = true, dataType = "Long", paramType = "path")
    @ApiResponses({@ApiResponse(code = 0, message = "请求成功"), @ApiResponse(code = -1, message = "没有更新记录,非0码则代表失败")})
    @DeleteMapping("/role/resource")
    CommonResponse<Boolean> roleResource(@PathVariable @NotNull Long id);

    /**
     * 根据用户id显示对应子系统信息——动态路由1
     * @param id
     * @return
     */
    @ApiOperation( value = "动态路由1——根据用户id显示对应子系统信息")
    @GetMapping( "/queryMenu1")
    @ResponseBody
    CommonResponse<List<Map<String, Object>>> queryMenuByRoleId(@NotNull @Valid Long id);

    /**
     * 根据子系统id显示对应菜单资源信息——动态路由2
     * @param id
     * @return
     */
    @ApiOperation( value = "动态路由2——根据子系统id显示对应菜单资源信息")
    @GetMapping( "/queryMenu2")
    @ResponseBody
    CommonResponse<List<ResourceMenuVO>> queryMenuBySubsId(@NotNull @Valid Long id);
}
